package com.dom.common.model.standard;

import com.dom.common.constants.ConstantError;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * 错误消息模型
 * @Author xllei
 * @Date 2018-11-06
 */
@Data
public class ErrorModel {
    private String errCode;
    private String errMsg;

    public void setErrCodeAndErrMsg(String errCode, String errMsg) {
        if (!StringUtils.isEmpty(errCode)) {
            this.errCode = errCode;
            this.errMsg = errMsg;
        }
    }

    public void setErrCodeAndErrMsg(ConstantError enumError) {
        this.errCode = enumError.getErrCode();
        this.errMsg = enumError.getErrMsg();
    }

    public boolean isErr() {
        if (!StringUtils.isEmpty(errCode)) {
            return true;
        } else {
            return false;
        }
    }
}
